<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;

class CommonController extends Controller
{
    public function upload()
    {

        $file=Input::file('Filedata');
        if($file->isValid()){
            $realPath=$file->getRealPath();//临时文件的绝对路径
            $entension=$file->getClientOriginalExtension();//上传文件后缀
            $newName=date("YmdHis").mt_rand(100,999).'.'.$entension;//重新定义的文件名
            $path=$file->move(base_path().'\uploads',$newName);
            return $filepath='uploads/'.$newName;
        }
    }
}
